import Vue from "vue";
import VueRouter from "vue-router";
import Main from "@/views/main";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "redirect",
    hidden: true,
    leaf: false,
    redirect: "/dashboard",
  },
  {
    path: "/login",
    name: "login",
    hidden: true,
    leaf: false,
    component: () => import("@/views/login"),
  },
  {
    path: "/dashboard",
    name: "概况",
    component: Main,
    hidden: false,
    leaf: false,
    icon: "el-icon-pie-chart",
    children: [
      {
        path: "/dashboard",
        name: "概况",
        component: () => import("@/views/dashboard/index"),
      },
    ],
  },
  {
    path: "/shop",
    name: "店铺",
    component: Main,
    hidden: false,
    leaf: true,
    icon: "el-icon-house",
    children: [
      {
        path: "/shop/config",
        name: "店铺信息",
        component: () => import("@/views/shop/config.vue"),
      },
      {
        path: "/shop/contact",
        name: "联系地址",
        component: () => import("@/views/shop/contact.vue"),
      },
      {
        path: "/shop/cert",
        name: "认证信息",
        component: () => import("@/views/shop/cert.vue"),
      },
      {
        path: "/shop/services",
        name: "服务保障",
        component: () => import("@/views/shop/services.vue"),
      },
    ],
  },
  {
    path: "/goods",
    name: "商品",
    component: Main,
    hidden: false,
    leaf: true,
    icon: "el-icon-house",
    children: [
      {
        path: "/goods/lists",
        name: "商品列表",
        component: () => import("@/views/goods/list.vue"),
      },
      {
        path: "/goods/brand",
        name: "品牌管理",
        component: () => import("@/views/goods/brand.vue"),
      },
      {
        path: "/goods/attr",
        name: "商品参数",
        component: () => import("@/views/goods/attr.vue"),
      },
      {
        path: "/goods/aftersale",
        name: "售后保障",
        component: () => import("@/views/goods/aftersale.vue"),
      },
      {
        path: "/goods/category",
        name: "店内分类",
        component: () => import("@/views/goods/category.vue"),
      },
      {
        path: "/goods/album",
        name: "相册管理",
        component: () => import("@/views/goods/album.vue"),
      },
    ],
  },
];

const router = new VueRouter({
  mode: "",
  routes,
});

export default router;
